const { Sequelize, DataTypes } = require('sequelize');
const sequelize = new Sequelize('tourism', 'root', '123456', {
    host: 'localhost',
    dialect: 'mysql',
    port: 3306,
})
sequelize.authenticate()
    .then(() => {
        console.log('数据库连接成功');
    })
    .catch(err => {
        console.error('数据库连接失败:', err);
    });

const initUserModel = require('./models/user');
const initJingdianModel = require('./models/jingdian');

const User = initUserModel(sequelize, DataTypes);
const Jingdian = initJingdianModel(sequelize, DataTypes);

module.exports = {
    sequelize,
    DataTypes,
    User,
    Jingdian,
};
